<%
'读取装备属性名'属性 05678'一个石头+16


function itemoption(infostr,byheader)


If byheader=0 Then 
		itemoption="无属性"
ElseIf byheader=1 Then
		if isChkInteger(Hexnumber(Hexinfo)) then 
		itemoption=left(Hexnumber(Hexinfo),5) 
		itemoption="数量："&itemoption
		End If 
Else
		'计算分别有多少石头和属性
		If byheader>15 Then 
			hole=Int(byheader/16) '石头数量
			attrib=((byheader/16)-hole)*8'属性数量 
		Else
			hole=0
			attrib=byheader/2

		End If 


Select Case  attrib '分段截取属性值
Case 1

infostr2=right(infostr,6)
OptionIndex1=Hexnumber(MID(infostr2,1,4))
strvalue1=Hexnumber(MID(infostr2,5,2))

set rs1=conn.execute("select *  from WEB_itemoption  where  OptionIndex="&OptionIndex1&"")
	str1=(rs1("MaxData")-rs1("minData"))/100
	str1=fix(str1*strvalue1)
	allstr1=Int(str1)+ rs1("minData")
	itemoption1=rs1("Description")&""&allstr1
rs1.close

Case 2

infostr2=right(infostr,12)
OptionIndex1=Hexnumber(MID(infostr2,1,4))
OptionIndex2=Hexnumber(MID(infostr2,7,4))

strvalue1=Hexnumber(MID(infostr2,5,2))
strvalue2=Hexnumber(MID(infostr2,11,2))

set rs1=conn.execute("select *  from WEB_itemoption  where  OptionIndex="&OptionIndex1&"")
	str1=(rs1("MaxData")-rs1("minData"))/100
	str1=fix(str1*strvalue1)
	allstr1=Int(str1)+ rs1("minData")
	itemoption1=rs1("Description")&""&allstr1
rs1.close


set rs2=conn.execute("select *  from WEB_itemoption  where  OptionIndex="&OptionIndex2&"")

	str2=(rs2("MaxData")-rs2("minData"))/100
	str2=fix(str2*strvalue2)

	allstr2=Int(Int(str2)+ rs2("minData"))

	itemoption2=rs2("Description")&""&allstr2

rs2.close


'itemoption="sasdasd"
'itemoption=itemoption2

Case 3
infostr2=right(infostr,18)
OptionIndex1=Hexnumber(MID(infostr2,1,4))
OptionIndex2=Hexnumber(MID(infostr2,7,4))
OptionIndex3=Hexnumber(MID(infostr2,13,4))

strvalue1=Hexnumber(MID(infostr2,5,2))
strvalue2=Hexnumber(MID(infostr2,11,2))
strvalue3=Hexnumber(MID(infostr2,17,2))

set rs1=conn.execute("select *  from WEB_itemoption  where  OptionIndex="&OptionIndex1&"")
	str1=(rs1("MaxData")-rs1("minData"))/100
	str1=fix(str1*strvalue1)
	allstr1=Int(str1)+ rs1("minData")
	itemoption1=rs1("Description")&""&allstr1
rs1.close

set rs2=conn.execute("select *  from WEB_itemoption  where  OptionIndex="&OptionIndex2&"")
	str2=(rs2("MaxData")-rs2("minData"))/100
	str2=fix(str2*strvalue2)
	allstr2=Int(str2)+ rs2("minData")
	itemoption2=rs2("Description")&""&allstr2
rs2.close

set rs3=conn.execute("select *  from WEB_itemoption  where  OptionIndex="&OptionIndex3&"")
	str3=(rs3("MaxData")-rs3("minData"))/100
	str3=fix(str3*strvalue3)
	allstr3=Int(str3)+ rs3("minData")
	itemoption3=rs3("Description")&""&allstr3
rs3.close

itemoption=itemoption1&itemoption2&itemoption3



Case 4

infostr2=Right(infostr,24)
OptionIndex1=Hexnumber(MID(infostr2,1,4))
OptionIndex2=Hexnumber(MID(infostr2,7,4))
OptionIndex3=Hexnumber(MID(infostr2,13,4))
OptionIndex4=Hexnumber(MID(infostr2,19,4))

strvalue1=Hexnumber(MID(infostr2,5,2))
strvalue2=Hexnumber(MID(infostr2,11,2))
strvalue3=Hexnumber(MID(infostr2,17,2))
strvalue4=Hexnumber(MID(infostr2,23,2))


set rs1=conn.execute("select *  from WEB_itemoption  where  OptionIndex="&OptionIndex1&"")
			If Not(rs1.eof Or rs1.bof) Then 
				str1=(rs1("MaxData")-rs1("minData"))/100
				str1=fix(str1*strvalue1)
				allstr1=Int(str1)+ rs1("minData")
				itemoption1=rs1("Description")&""&allstr1
			End If


rs1.close

set rs2=conn.execute("select *  from WEB_itemoption  where  OptionIndex="&OptionIndex2&"")
	If Not(rs2.eof Or rs2.bof) Then 
		str2=(rs2("MaxData")-rs2("minData"))/100
		str2=fix(str2*strvalue2)
		allstr2=Int(str2)+ rs2("minData")
		itemoption2=rs2("Description")&""&allstr2
	End If
rs2.close

set rs3=conn.execute("select *  from WEB_itemoption  where  OptionIndex="&OptionIndex3&"")
	If Not(rs3.eof Or rs3.bof) Then 
		str3=(rs3("MaxData")-rs3("minData"))/100
		str3=fix(str3*strvalue3)
		allstr3=Int(str3)+ rs3("minData")
		itemoption3=rs3("Description")&""&allstr3
	End If
rs3.close

set rs4=conn.execute("select *  from WEB_itemoption  where  OptionIndex="&OptionIndex4&"")
	If Not(rs4.eof Or rs4.bof) Then 
		str4=(rs4("MaxData")-rs4("minData"))/100
		str4=fix(str4*strvalue4)
		allstr4=Int(str4)+ rs4("minData")
		itemoption4=rs4("Description")&""&allstr4
	End If

rs4.close

itemoption=itemoption1&"&nbsp;"&itemoption2&"&nbsp;"&itemoption3&"&nbsp;"&itemoption4

End Select 


Select Case  hole '分段截取石头属性值

Case 1
HoleIndex1=Hexnumber(left(infostr,4))


If HoleIndex1<>0000 Then 
set rs1=conn.execute("select *  from WEB_itemetc_socket  where  id="&HoleIndex1&"")
	socketoption1=rs1("name")&rs1("value")
rs1.close
End If

Case 2
infostr2=left(infostr,8)
HoleIndex1=Hexnumber(left(infostr2,4))
HoleIndex2=Hexnumber(MID(infostr2,1,4))

If HoleIndex1<>0000 Then 
	set rs1=conn.execute("select *  from WEB_itemetc_socket  where  id="&HoleIndex1&"")
		socketoption1=rs1("name")&rs1("value")
	rs1.close
End If

If HoleIndex2<>0000 Then 
	set rs2=conn.execute("select *  from WEB_itemetc_socket  where  id="&HoleIndex2&"")
		socketoption2=rs2("name")&rs2("value")
	rs2.close
	socketoption=socketoption1+socketoption2
End If

Case 3
infostr2=left(infostr,12)
HoleIndex1=Hexnumber(left(infostr2,4))
HoleIndex2=Hexnumber(MID(infostr2,5,4))
HoleIndex3=Hexnumber(MID(infostr2,9,4))

If HoleIndex1<>0000 Then 
	set rs1=conn.execute("select *  from WEB_itemetc_socket  where  id="&HoleIndex1&"")
		socketoption1=rs1("name")&rs1("value")
	rs1.close
End If

If HoleIndex2<>0000 Then 
	set rs2=conn.execute("select *  from WEB_itemetc_socket  where  id="&HoleIndex2&"")
		socketoption2=rs2("name")&rs2("value")
	rs2.close
End If

If HoleIndex3<>0000 Then 
	set rs3=conn.execute("select *  from WEB_itemetc_socket  where  id="&HoleIndex3&"")
		socketoption3=rs3("name")&rs3("value")
	rs3.close
End If

socketoption=socketoption1+socketoption2+socketoption3


Case 4
infostr2=left(infostr,16)
HoleIndex1=Hexnumber(left(infostr2,4))
HoleIndex2=Hexnumber(MID(infostr2,5,4))
HoleIndex3=Hexnumber(MID(infostr2,9,4))
HoleIndex4=Hexnumber(MID(infostr2,13,4))


If HoleIndex1<>0000 Then 
	set rs1=conn.execute("select *  from WEB_itemetc_socket  where  id="&HoleIndex1&"")
		socketoption1=rs1("name")&rs1("value")
	rs1.close
End If

If HoleIndex2<>0000 Then 


	set rs2=conn.execute("select *  from WEB_itemetc_socket  where  id="&HoleIndex2&"")
		socketoption2=rs2("name")&rs2("value")

	rs2.close
End If

If HoleIndex3<>0000 Then 
	set rs3=conn.execute("select *  from WEB_itemetc_socket  where  id="&HoleIndex3&"")
		socketoption3=rs3("name")&rs3("value")
	rs3.close
End If

If HoleIndex4<>0000 Then 
	set rs4=conn.execute("select *  from WEB_itemetc_socket  where  id="&HoleIndex4&"")
		socketoption4=rs4("name")&rs4("value")

	rs4.close
End If

socketoption=socketoption1+socketoption2+socketoption3+socketoption4

'Response.write "<br>socketoption1="&socketoption1
'Response.write "<br>socketoption2="&socketoption2
'Response.write "<br>socketoption3="&socketoption3
'Response.write "<br>socketoption4="&socketoption4
'Response.write "<br>"&socketoption4
End Select 

itemoption=itemoption&socketoption

End If  

'Response.write "<br>infostr="&infostr
'Response.write "<br>hole="&hole
'Response.write "<br>attrib="&attrib
'Response.write "<br>itemoption="&itemoption
'Response.write "<br>socketoption="&socketoption

End Function

'远程获取物理ip
function getHTTPPage(ip)
dim Http
set Http=server.createobject("MSXML2.XMLHTTP")
url="http://whois.pconline.com.cn/ip.jsp?ip="&ip
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
end function
'2、转换乱玛，直接用xmlhttp调用有中文字符的网页得到的将是乱玛，可以通过adodb.stream组件进行转换
Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function



function browser() '浏览器版本 
agent = Request.ServerVariables("HTTP_USER_AGENT") 
if Instr(agent,"Windows ")>0 then 
browser="pc"
else 
browser="Android" 
end if 
end function
strPath = request.serverVariables("PATH_INFO")
pageLink = LCase(Mid(strPath, instrRev(strPath, "/") + 1))

'写日志

Function Add_Log(user_no,user_id,character_no,Char_Name,Admin_Action,logtype,note)

AdminIp = Request.ServerVariables("REMOTE_ADDR")
user_no=user_no
user_id=user_id
character_no=character_no
Char_Name=Char_Name
Admin_Action=Admin_Action
logtype=logtype
note=note
If logtype="1" Then 
 character_no="null"
 Char_Name="null"
End If 
If note="" Then note="null"
Admin_Name=request.cookies(CookiesName)("user_id")
'set rs_log=conn.execute("INSERT INTO adminlog (Admin,user_no,user_id,character_no,Char_Name,datetime,ip,Action,logtype,note) VALUES('"&Admin_Name&"',"&user_no&",'"&user_id&"','"&character_no&"','"&Char_Name&"',getdate(),'"&AdminIp&"','"&Admin_Action&"',"&logtype&",'"&note&"')") '写日志
qq=("INSERT INTO adminlog (Admin,user_no,user_id,character_no,Char_Name,datetime,ip,Action,logtype,note) VALUES('"&Admin_Name&"',"&user_no&",'"&user_id&"','"&character_no&"','"&Char_Name&"',getdate(),'"&AdminIp&"','"&Admin_Action&"',"&logtype&",'"&note&"')") '写日志



'Response.write qq
End Function

Function CheckAdmin()'验证管理员

isadmin=0
			If (request.cookies(CookiesName)("UserName")=adminname And  request.cookies(CookiesName)("Password")=adminpass) Or  (request.cookies(CookiesName)("UserName")=adminname2 And  request.cookies(CookiesName)("Password")=adminpass2)  Or  (request.cookies(CookiesName)("UserName")=adminname3 And  request.cookies(CookiesName)("Password")=adminpass3) Then 
				If request.cookies(CookiesName)("UserName")=adminname  And adminflag=1 Then session("SuperAdmin")=1
				If request.cookies(CookiesName)("UserName")=adminname2  And adminflag2=1 Then session("SuperAdmin")=1
				If request.cookies(CookiesName)("UserName")=adminname3  And adminflag3= 1 Then session("SuperAdmin")=1
				isadmin=1
		End If

If isadmin<>1 Then 
		Response.Cookies(CookiesName)("UserName") = ""
		Response.Cookies(CookiesName)("Password") = ""
		Session.Abandon()
		response.redirect "login.asp"
		response.End
End If

End Function




Function Head(Strtitle) '头部
If Strtitle="" Then Strtitle=ServerName





%>
<!doctype html>
<html lang="en">

<head>
  <meta charset="UTF-8">
        <title><%=Strtitle%></title>
  <meta name="renderer" content="webkit|ie-comp|ie-stand">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="shortcut icon" href="./lib/favicon.ico" type="image/x-icon" />
  <link rel="stylesheet" href="./lib/css/font.css">
  <link rel="stylesheet" href="./lib/css/weadmin.css">

<script src="./lib/js/jquery.min.js"></script> 

 <script src="./lib/layui/layui.js" charset="utf-8"></script>
  <script type="text/javascript" src="./lib/js/ajax.js" charset="utf-8"></script>
  <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
  <!--[if lt IE 9]>
    <script src="https://cdn.libfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.libfile.org/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->


</head>

<body>
  <!-- 顶部开始 -->
  
  <%If Strtitle<>"装备查看" Then%>

  <div class="container" >
    <div class="logo layuimini-logo">
      <a href="javascript:;"><img src="lib/images/logo.png" alt="logo"><h1>WS管理系统</h1></a>
    </div>

<%If browser()="pc" Then%>
    <div class="left_open">
      <!-- <i title="展开左侧栏" class="iconfont">&#xe699;</i> -->
      <i title="展开左侧栏" class="layui-icon layui-icon-shrink-right"></i>

    </div>
    <ul class="layui-nav left fast-add" lay-filter="">
      <li class="layui-nav-item">
        <a href="javascript:;">快捷菜单</a>
        <dl class="layui-nav-child">
          <!-- 二级菜单 -->
		   <dd>
            <a onclick="WeAdminShow('资讯','index.asp')"><i class="layui-icon layui-icon-list"></i>一区管理</a>
          </dd>
          <dd>
            <a onclick="WeAdminShow('图片','http://www.baidu.com')"><i
                class="layui-icon layui-icon-picture-fine"></i>个人信息</a>
          </dd>
          <dd>
            <a href="login.asp?Action=Logout"><i class="layui-icon layui-icon-user"></i>退出</a>
          </dd>
          
        </dl>
      </li>
    </ul><%End if%><div id="onlineinfo"></div>
  <script>
   getPart('./inc/online.asp')
	setInterval("getPart('./inc/online.asp')",3000)
  </script>


  </div>
  <%End if%>
  <!-- 顶部结束 -->
<%
End Function
Function LeftMenu() 
%>
<!-- 左侧菜单开始 -->
    <div class="left-nav"> 
    <ul class="nav" id="nav">
	<li><a href="index.asp"<%	If pageLink=lcase("index.asp")  Or pageLink ="" Then 	response.write "class=""active""" %>><i class="iconfont">&#xe757;</i><cite>数据统计</cite><i class="iconfont nav_right"></i></a></li>
     <li><a href="User_list.asp"<%If pageLink=lcase("User_list.asp")  Or pageLink =lcase("User_Edit.asp")  Then 	response.write "class=""active""" %>><i class="iconfont">&#xe6b8;</i><cite>用户账号</cite><i class="iconfont nav_right"></i></a></li>
     <li><a href="Char_list.asp"<%If pageLink=lcase("Char_list.asp")  Or pageLink =lcase("Char_Edit.asp")  Then 	response.write "class=""active""" %>><i class="iconfont">&#xe696;</i><cite>游戏角色</cite><i class="iconfont nav_right"></i></a></li>
     <li><a href="Log_list.asp"<%If pageLink=lcase("Log_list.asp") Then response.write "class=""active""" %>><i class="iconfont">&#xe71c;</i><cite>管理日志</cite><i class="iconfont nav_right"></i></a>
     <li><a href="Pay_List.asp"<%If pageLink=lcase("Pay_List.asp")  Then response.write "class=""active""" %>><i class="iconfont">&#xe758;</i><cite>充值管理</cite><i class="iconfont nav_right"></i></a>
     <li><a href="News_List.asp"<%If pageLink=lcase("News_List.asp")    Or pageLink =lcase("News_Edit.asp")  Then response.write "class=""active""" %>><i class="iconfont">&#xe74e;</i><cite>公告管理</cite><i class="iconfont nav_right"></i></a>
	 <li><a href="Black_List.asp"<%If pageLink=lcase("Black_List.asp") Then response.write "class=""active""" %>><i class="iconfont">&#xe6ce;</i><cite>黑名单</cite><i class="iconfont nav_right"></i></a>
     <li><a _href=""><i class="iconfont">&#xe698;</i><cite>寄售系统</cite><i class="iconfont nav_right"></i></a></li>
	   <ul class="sub-menu">
       <li><a href="shop_edit.asp?Action=Add"<%If pageLink ="Add"  Then response.write "class=""active""" %>><i class="iconfont"></i><cite>添加道具</cite></a></li>
       <li><a href="shop_list.asp"<%If pageLink=lcase("shop_list.asp")  Or pageLink ="Edit"  Then response.write "class=""active""" %>><i class="iconfont"></i><cite>道具管理</cite></a></li>
       <li><a href="order_list.asp"<%If pageLink=lcase("order_list.asp") Then response.write "class=""active""" %>><i class="iconfont"></i><cite>订单管理</cite></a></li>
      </ul>
	  </li>
    </ul>
  </div>
<!-- 左侧菜单结束 -->
<%
End Function
Function Search()
%>

                    <div class="layui-card">
                        <div class="layui-card-body">
<table width="99%" cellpadding="2" cellspacing="0">
  <tr>
    <td width="50%">

<form class="layui-form layui-col-space5" action="User_List.asp" method="get">
                                <div class="layui-inline layui-show-xs-block">
                                    <input type="text" name="txtSearch"  placeholder="请输入用户名" autocomplete="off" class="layui-input">
                                </div>
								<div class="layui-inline layui-show-xs-block">
								<input type="checkbox" name="SearchType" title="精确" value="1">
								</div>
                                <div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn layui-btn-normal layui-btn-sm"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i>搜索</button>
                                </div>
                            </form>

		
		</td>
    <td>
<div style="float: right;">
	<form  class="layui-form layui-col-space5" action="Char_List.asp" method="get" name="form1">
                                <div class="layui-inline layui-show-xs-block">
                                    <input type="text" name="txtSearch"  placeholder="角色信息搜索" autocomplete="off" class="layui-input">
                                </div>  
								<div class="layui-inline layui-show-xs-block">
								<input type="checkbox" name="SearchType" title="精确" value="1">
								</div>
                                <div class="layui-inline layui-show-xs-block">
                                    <button class="layui-btn layui-btn-normal layui-btn-sm"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i>搜索</button>
                                </div>
    </form>
	</div>
	</td>
  </tr>
</table>



                        </div>


                    </div>

<%
End Function
Function footer()
%>
  <div class="page-content-bg"></div>
  <!-- 右侧主体结束 -->
  <!-- 中部结束 -->
  <!-- 底部开始 -->
  <%If browser()="pc1" Then%>
  <div class="footer">
    <div class="copyright">ET管理系统 v1.6    Request Time <%=Int(FormatNumber((Timer() - TimerStart) * 1000, 3))%> ms<%'Request.ServerVariables("HTTP_USER_AGENT") %></div>
  </div>
  <%End If%>
  <!-- 底部结束 -->
  <script type="text/javascript">
    // layui扩展模块的两种加载方式 - 示例
    // layui.extend({
    //   admin: '{/}../../lib/js/admin' // {/}的意思即代表采用自有路径，即不跟随 base 路径
    // });
    // //使用拓展模块
    // layui.use('admin', function () {
    //   var admin = layui.admin;
    // });
    var showFooter = true; // 控制是否显示底部示例参数，相关逻辑可删除
    layui.config({
      base: './lib/js/'
      , version: '101100'
    }).extend({ //设定模块别名
      admin: 'admin'
      , menu: 'menu'
      , http: 'http'
    });
    layui.use(['jquery', 'admin', 'menu', 'http'], function () {
      var $ = layui.jquery,
        admin = layui.admin,
        http = layui.http,
        menu = layui.menu;

      $(function () {
        http.getMenu();
        admin.tab.tabInit();
        // menu.getMenu('./json/menu.json');

      });
    });

  </script>
<%
End Function
Function mnav()

%>
	<div class="weadmin-nav">
	<%If browser()="pc" Then%>

	<span class="layui-breadcrumb" style="visibility: visible;font-size: 13px">
      <i class="iconfont">&#xe70c;</i>&nbsp;&nbsp;<a href="index.asp"><%=ServerName%> </a><span lay-separator="">/</span>
      <a href=""><%= Replace(strtitle,ServerName&"-","")%> </a><span lay-separator="">
    </span>
<%else%> 
		<span style="color: #666;font-size: 14px">
        <a href="index.asp">统计</a>  &nbsp;|  &nbsp;
        <a href="User_list.asp">账号</a>  &nbsp;|  &nbsp;
        <a href="Char_list.asp">角色</a>  &nbsp;|  &nbsp;
        <a href="Black_List.asp">黑名单</a>  &nbsp;|  &nbsp;
        <a href="news_list.asp">公告</a>  &nbsp;|  &nbsp;
        <a href=".asp"><cite>寄售</cite></a>  
		</span>
		<%End If %>
	</div>
<%

End Function
Function DataClose()
    Set Rs=Nothing
	Conn.Close
	Set Conn=Nothing
End Function 

Function cacuIp(ip)'IP转换
Dim srIp, aIp
If ip="" Then Exit Function
srIp=0
aIp = Split(ip,".")
If UBound(aIP)<>3 Then
cacuIP=0
Exit Function
End If
For ii=0 To 3
srIp=srIp+(CInt(aIP(ii))*(256^(3-ii)))
Next
cacuIp=srIp-1
End Function 

function ChkPost()	'检查外部提交数据
	chkpost=false
	server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
	server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
	if mid(server_v1,8,len(server_v2))<>server_v2 then
		chkpost=false
	else
		chkpost=true
	end if
end function

 Function GetCode()
	Randomize
	GetCode=cstr(Int((9999 - 1000 + 1) * Rnd() + 1000))
	session("GetCode")=GetCode
End Function

Function GetClass(Str)
							Str=Int(Str)
							Select case Str
							case 0
							GetClass="战士"
							case 1
							GetClass="法师"
   							case 3 
   							GetClass="驱魔师"
   							case 4 
   							GetClass="巫师"
   							case 5 
   							GetClass="狂战士"
   							case 6 
   							GetClass="魔枪手"
   							case 7 
   							GetClass="龙骑士"
   							case 9 
   							GetClass="暗咒师"
   							case 10 
   							GetClass="女武神"
   							case 11 
   							GetClass="死神"
   							case 12 
   							GetClass="女战圣"

							End select	
End Function


	Public Function Checkstr(Str)
		If Isnull(Str) Then
			CheckStr = ""
			Exit Function 
		End If
		Str = Replace(Str,Chr(0),"")
		CheckStr = Replace(Str,"'","''")
	End Function


'判断角色在线
Public Function CheckCharOnline(Str)
		If Isnull(Str) Then
			CheckStr = ""
			Exit Function 
		End If
		Str = Replace(Str,Chr(0),"")
		CheckStr = Replace(Str,"'","''")
	End Function

'判断用户在线
Public Function CheckUserOnline(Str)
		If Isnull(Str) Then
			CheckStr = ""
			Exit Function 
		End If
		Str = Replace(Str,Chr(0),"")
		CheckStr = Replace(Str,"'","''")
	End Function
'在线人数
Public Function OnlineNuM(Str)
		If Isnull(Str) Then
			CheckStr = ""
			Exit Function 
		End If
		Str = Replace(Str,Chr(0),"")
		CheckStr = Replace(Str,"'","''")
	End Function
'取得含有中文字符串的长度
Function chLen(Str)
    Dim i
    chLen = 0
    If Len(Str) < 1 Then Exit Function
    For i = 1 To Len(Str)
        If Asc(Mid(Str, i, 1)) > 0 Then
            chLen = chLen + 1
        Else
            chLen = chLen + 2
        End If
    Next
End Function

function cip(dwip)


'cip=Int(dwip)
'Exit Function 
If dwip<16777216 Or dwip="" Then 
Exit Function 
End If 
a=int(dwip/16777216)
b=int((dwip-a*16777216)/65536)
c=int((dwip-a*16777216-b*65536)/256)
d=int((dwip-a*16777216-b*65536-c*256))
cip=a&"."&b&"."&c&"."&d
End function

'****************************************************************
'参数vBadIP：要屏蔽的IP段,IP地址集合，用|符号分隔多个IP地址(段)
'返回Bool：True用户IP在被屏蔽范围，False 反之
'****************************************************************
Function IsForbidIP(vBadIP)
    Dim counter, arrIPPart, arrBadIP, arrBadIPPart, i, j
   arrBadIP = Split(vBadIP, "|")    
   arrIPPart = Split(GetIP(), ".")
    For i = 0 To UBound(arrBadIP)         
        counter = 0
        arrBadIPPart = Split(arrBadIP(i), ".")        
        For j = 0 To UBound(arrIPPart)             
            If(arrBadIPPart(j)) = "*" or Cstr(arrIPPart(j)) = Cstr(arrBadIPPart(j)) Then            
               counter = counter + 1            
            End If            
        Next        
        If counter = 4 Then            
           IsForbidIP = True
            Exit Function
       End If        
    Next
    IsForbidIP = False
End Function

'***************
'返回客户IP地址
'***************
Function GetIP()
    GetIP =Request.ServerVariables("REMOTE_ADDR")
End Function

'***************
'获取物理IP地址
'***************
Function IpAddr(ip)
			If  Len(ip)<5 Then Exit Function 
			iIp = cacuIp(IP)

			'Set rs_ip = conn_ip.Execute ( "SELECT IP_Provence,IP_Address FROM ipdata WHERE IP1<=" & iIp & " AND IP2>=" & iIp )
			 Set rs_ip = CONN.Execute ( "SELECT IP_Provence,IP_Address FROM ipdata WHERE IP1<=" & iIp & " AND IP2>=" & iIp )
			IpAddr = rs_ip("IP_Provence")&""&rs_ip("IP_Address")
			rs_ip.Close

	'getHTTPPage(cip(Int(Hexnumber(ShowHex(page("user_ip_addr"))))))

End Function

Function GetUrl()
    GetUrl=Request.ServerVariables("HTTP_REFERER")
End Function


'格式化字符串
function ShowHex(data)
    dim l
    dim i 
    dim ch

	If IsNull(data) Then 
	Exit Function 
	End If 

    l=lenB(data)


    for i = 1 to l 
        ch=midB(data,i,1)
        h=trim(hex(ascB(ch)))
        if len(h)=1 then
           h="0"+h
        end if
        ShowHex=ShowHex+h+""
        'if i mod 15 =0 then 
           'response.write "<br>"
        'end if
    Next
  ShowHex=ShowHex
end Function




'16转10进制
Function Hexnumber(nums)
Dim tmp,tmpstr,i

nums_len=Len(nums)
For i=1 To nums_len
tmp=Mid(nums,i,1)
If IsNumeric(tmp) Then
tmp=tmp * 16 * (16^(nums_len-i-1))
Else
tmp=(ASC(UCase(tmp))-55) * (16^(nums_len-i))
End If
tmpstr=tmpstr+tmp
Next
Hexnumber=tmpstr
'tmpstr=tmpstr-2'减2
End Function
'判断整形
function isChkInteger(para)
       on error resume next
       dim str
       dim l,i
       if isNUll(para) then 
          isChkInteger=false
          exit function
       end if
       str=cstr(para)
       if trim(str)="" then
          isChkInteger=false
          exit function
       end if
       l=len(str)
       for i=1 to l
           if mid(str,i,1)>"9" or mid(str,i,1)<"0" then
              isChkInteger=false 
              exit function
           end if
       next
       isChkInteger=true
       if err.number<>0 then err.clear
end Function

'10进制转16进制
function chn16(Ints)
dim IntPam, Rmder, RmderStr, a
IntPam = Ints	 '赋被除数
Rmder = IntPam - Fix(IntPam / 16) * 16	 '取余数
RmderStr = CStr(hex(Rmder)) & RmderStr	 '将余数连合
Do While IntPam > 16
IntPam = Fix(IntPam / 16)	 '取次级被除数
Rmder = (IntPam - Fix(IntPam / 16) * 16) '取余数
RmderStr = CStr(hex(Rmder)) & RmderStr	 '将余数连合
loop
chn16 = RmderStr
end Function

'url解码
function URLDecode(strIn)
    URLDecode = ""
    Dim sl: sl = 1
    Dim tl: tl = 1
    Dim key: key = "%"
    Dim kl: kl = Len(key)
 
    sl = InStr(sl, strIn, key, 1)
    Do While sl>0
        If (tl=1 And sl<>1) Or tl<sl Then
            URLDecode = URLDecode & Mid(strIn, tl, sl-tl)
        End If
 
        Dim hh, hi, hl
        Dim a
        Select Case UCase(Mid(strIn, sl+kl, 1))
            Case "U":                  'Unicode URLEncode
            a = Mid(strIn, sl+kl+1, 4)
            URLDecode = URLDecode & ChrW("&H" & a)
            sl = sl + 6
 
            Case "E":                   'UTF-8 URLEncode
            hh = Mid(strIn, sl+kl, 2)
            a = Int("&H" & hh)          'ascii码
            If Abs(a)<128 Then
                sl = sl + 3
                URLDecode = URLDecode & Chr(a)
            Else
                hi = Mid(strIn, sl+3+kl, 2)
                hl = Mid(strIn, sl+6+kl, 2)
                a = ("&H" & hh And &H0F) * 2 ^12 Or ("&H" & hi And &H3F) * 2 ^ 6 Or ("&H" & hl And &H3F)
                If a<0 Then a = a + 65536
                URLDecode = URLDecode & ChrW(a)
                sl = sl + 9
            End If
        Case Else:                      'Asc URLEncode
            hh = Mid(strIn, sl+kl, 2)   '高位
            a = Int("&H" & hh)          'ascii码
            If Abs(a)<128 Then
            sl = sl + 3
            Else
            hi = Mid(strIn, sl+3+kl, 2) '低位
            a = Int("&H" & hh & hi)     '非ascii码
            sl = sl + 6
            End If
            URLDecode = URLDecode & Chr(a)
        End Select
 
        tl = sl
        sl = InStr(sl, strIn, key, 1)
    Loop
 
    URLDecode = URLDecode & Mid(strIn, tl)
End Function
'随机数

function createssn()
	RANDOMIZE
	createssn = left(INT(now()*(20000000000 * RND)),15)
end Function


function MapName(wMapIndex)

select case wMapIndex
case 0
MapName="混沌城堡"
case 1
MapName="精灵草原"
case 2
MapName="魔界之洞"
case 3
MapName="红叶谷地"
case 4
MapName="新手村庄"
case 5
MapName="暴风雪原"
case 6
MapName="女神神殿"
case 7
MapName="赤炎城堡"
case 8
MapName="玄武之地"
case 9
MapName="古战场"
case 10
MapName="幽灵地堡"
case 11
MapName="复仇冰谷"
case 12
MapName="克拉斯波"
case 13
MapName="幽魔沙漠"
case 14
MapName="魔界之洞二层"
case 15
MapName="幽灵地堡二层"
case 16
MapName="混沌城堡地牢"
case 17
MapName="白鹭海岸"
case 18
MapName="火山岛"
case 19
MapName="皮顿城堡"
case 20
MapName="黑龙之墓"
case 21
MapName="受诅咒的迷宫"
case 22
MapName="无限角斗场"
case 23
MapName="蒂诺亚城"
case 24
MapName="破裂的魔法阵 C"
case 25
MapName="克拉斯波的珍宝 C"
case 26
MapName="海底遗迹"
case 27
MapName="新兵的迷宫"
case 28
MapName="新兵的迷宫"
case 29
MapName="深渊洞穴"
case 30
MapName="破裂的魔法阵 B"
case 31
MapName="破裂的魔法阵 A"
case 32
MapName="克拉斯波的珍宝 B"
case 33
MapName="克拉斯波的珍宝 A"
case 34
MapName="破裂的魔法阵最深处"
case 35
MapName="农巴伊斯神殿"
case 36
MapName="农巴伊斯神殿"
case 37
MapName="农巴伊斯神殿"
case 39
MapName="死亡前哨战 [炼狱]"
case 40
MapName="死亡前哨战 [恐怖]"
case 41
MapName="死亡前哨战 [考验]"
case 42
MapName="死亡前哨战 [试炼]"
case 43
MapName="死亡前哨战 [折磨]"
case 44
MapName="死亡前哨战 [恶梦]"
case 45
MapName="燃烧平原"
case 46
MapName="神邸的废墟"
case 47
MapName="巡礼空间"
case 48
MapName="瞿鲁耶 莱亚娜"
case 49
MapName="凯鲁宾巢穴"
case 50
MapName="狮鹫圣地"
case 51
MapName="迷雾群岛"
case 52
MapName="卡隆的运输船 C"
case 53
MapName="卡隆的运输船 B"
case 54
MapName="卡隆的运输船 A"
case 55
MapName="卡隆的运输船 S"
case 56
MapName="竞技场"
case 57
MapName="绿洲联盟"
case 58
MapName="魔教秘密基地"
case 59
MapName="海丽斯特永恒战场"
case 60
MapName="死亡魔界 [梦魇]"
case 61
MapName="混沌城堡-中介所"
case 62
MapName="赤炎城堡-中介所"
case 63
MapName="死亡之地"
case 64
MapName="死亡之屋"
case 65
MapName="冰雾神殿"
case 66
MapName="死亡回廊"
case 67
MapName="众神的战场"
case 68
MapName="远古埃及"
case 69
MapName="远古埃及Ⅱ"
case 70
MapName="亚瓦伦岛"
case 71
MapName="克拉斯波基地"
case 72
MapName="月影之地"
case 73
MapName="月影之地I"
case 74
MapName="月影之地II"
case 75
MapName="月影之地V"
case 77
MapName="巨蟒宫殿"
case 88
MapName="信徒的安息地"
case 89
MapName="通天魔塔"
case 90
MapName="通天魔塔"
case 91
MapName="通天魔塔"
case 92
MapName="通天魔塔"
case 93
MapName="通天魔塔"
case 150
MapName="平静河谷"
case 151
MapName="巴茨的遗迹"
case 152
MapName="卢德妮的遗迹"
case 153
MapName="异教徒秘密角斗场"
case 156
MapName="荒凉谷地"
case 158
MapName="艾伦恩湿地"
case 159
MapName="艾伦恩"
case 162
MapName="大型竞技场广场"
case 166
MapName="冰凍者的峽谷"
case 177
MapName="贫瘠之城内城"
case 180
MapName="爱尔格"
case 181
MapName="德拉巴斯祕密通道"
case 182
MapName="德拉巴斯村庄"
case 183
MapName="德拉巴斯领地"
case 184
MapName="德拉巴斯领地"
case 533
MapName="米特拉"
case 566
MapName="阿尔卡迪亚"
case else
MapName="未知地图"
end Select
End Function

Function Item_attrib()
%>
<option value="CD3CFF">致命+158</option>
	<option value="CD38FF">毒素攻击力 +141</option>
	<option value="CD3BFF">活力+89</option>
	<option value="CD37FF">魔法攻击力 +137</option>
	<option value="C3D9FF">物攻+118</option>
	<option value="C3CFFF">远程最小攻击力增加+101</option>
	<option value="D620FF">格挡+78</option>
	<option value="D61FFF">全部属性抵抗力增加+130</option>
	<option value="D61DFF">防御力 +239</option>
	<option value="DB03FF">魔法抗性 +229</option>
	<option value="DB02FF">伤害减免 +%4</option>
	<option value="DB00FF">近距伤害耐性 +%4</option>
	<option value="DB01FF">远距伤害耐性 +%4</option>
	<option value="78BFFF">最大HP +431</option>
	<option value="7F5BFF">暴击抵抗 +4%</option>
	<option value="02B6FF">活力 +	1235</option>
	<option value="02B7FF">暴击 +	485</option>
	<option value="02B8FF">近距离攻击力 +	351</option>
	<option value="02B9FF">近距离攻击力 +	2220</option>
	<option value="02BAFF">暴击抵抗%	6</option>
	<option value="02BBFF">近距离伤害抵抗	6</option>
	<option value="02BCFF">生命上限 +	11650</option>
	<option value="02BDFF">生命上限 +	14650</option>
	<option value="02BEFF">所有属性抵抗力+	404</option>
	<option value="02BFFF">护盾上限 +	106500</option>
	<option value="02C0FF">火焰攻击力 +	3549</option>
	<option value="02C1FF">生命恢复力 +	116000</option>
<%
End Function
Function Stone_attrib()

%>
<option value="0000">空洞</option>
			<option value="18AB">V-火5%</option>
			<option value="18A9">V-冰5%</option>
			<option value="18AD">V-电5%</option>
			<option value="18AF">V-毒5%</option>
			<option value="18B1">V-诅5%</option>
			<option value="197E">D-招架结晶132 （头盔）</option>
			<option value="19A6">D-所有抗79（盔甲）</option>
			<option value="19EE">D-不灭腰带（腰带）</option>
			<option value="1974">D-致命142（武器）</option>
			<option value="1919">D-生命石头（手环）</option>
<%
End Function
%>